<?php
require_once dirname(__FILE__) . '/common/common.inc.php';

header('Content-Type: text/plain');

$args = json_decode(MiscUtils::decryptParam('action', '[]'));

$file_name = $args->t;
$name = $args->n;
$file_dir = UPDIR . $args->a . '/';

if (!file_exists($file_dir . $file_name)) {
  echo "文件找不到";
  exit;
} else {
  $file = fopen($file_dir . $file_name, "r");
  //输入文件标签   
  Header("Content-type: application/octet-stream");
  Header("Accept-Ranges: bytes");
  Header("Accept-Length:" . filesize($file_dir . $file_name));
  Header("Content-Disposition: attachment; filename=" . $name);
  //输出文件内容   
  echo fread($file, filesize($file_dir . $file_name));
  fclose($file);
  exit;
}
?>